package com.cloudpivot.receivales.meetingtemp.repository;


import com.cloudpivot.receivales.meetingtemp.entity.MeetingTempPicItemEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface MeetingTempAttListRepository extends JpaRepository<MeetingTempPicItemEntity, String> {

    //获取照片
    @Query(nativeQuery = true, value = "SELECT " +
            "b.meetingname," +
            "a.bizObjectId," +
            "a.bizPropertyCode," +
            "a.fileExtension," +
            "a.NAME," +
            "a.refId " +
            "FROM " +
            "h_biz_attachment a " +
            "LEFT JOIN i7hb4_meeting_ledger b ON a.bizObjectId = b.id  " +
            "WHERE " +
            "schemaCode = 'Meeting_ledger' " +
            "AND a.bizPropertyCode IN ( 'Attachment1702364628040', 'Attachment1702364629970', 'Attachment1702364631568', 'Attachment1702364633276')  " +
            "AND a.bizObjectId = :id")
    List<MeetingTempPicItemEntity> getMeetingPicItems(@Param(value = "id") String id);

    //获取附件
    @Query(nativeQuery = true, value = "SELECT " +
            " b.meetingname, " +
            " a.bizObjectId, " +
            " a.bizPropertyCode, " +
            " a.fileExtension, " +
            " a.NAME, " +
            " a.refId  " +
            "FROM " +
            " h_biz_attachment a " +
            " LEFT JOIN i7hb4_meeting_ledger b ON a.bizObjectId = b.id  " +
            "WHERE " +
            " schemaCode = 'Meeting_ledger'  " +
            " AND a.bizPropertyCode IN ( 'Attachment1702364600523')  " +
            " AND a.bizObjectId = :id")
    List<MeetingTempPicItemEntity> getMeetingAttItems(@Param(value = "id") String id);


}
